#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <bitset>
using namespace std;
int main(){
int t;cin>>t;
while(t--){
int n,p;cin>>n>>p;
int num=0;
for(int i=1;i<n;i++){
for(int j=i+1;j<=n;j++){
cout<<i<<' '<<j<<endl;
num++;
if(num==(2*n+p)){
i=n;
break;
}
}
}
}
}
Factorial equations | Removal of vertices |
Happy segments | Cyclic shifts |
Zoos | Build a graph |
Almost correct bracket sequence | Count of integers |
Differences of the permutations | Doctor's Secret |
Back to School | I am Easy |
Teddy and Tweety | Partitioning binary strings |
Special sets | Smallest chosen word |
Going to office | Color the boxes |
Missing numbers | Maximum sum |
13 Reasons Why | Friend's Relationship |
Health of a person | Divisibility |
A. Movement | Numbers in a matrix |
Sequences | Split houses |
Divisible | Three primes |